<template>
  <div class="app-container">
   <el-form :inline="true" ref="ruleForm"  :model="formInline" class="demo-form-inline">
    <el-form-item label="日期" prop="time">
      <el-date-picker
      class="date-picker-box"
        v-model="formInline.time"
        type="datetimerange"
        align="right"
        unlink-panels
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
        value-format="yyyy-MM-dd HH:mm:ss"
        :default-time="['00:00:00', '23:59:59']"
        :picker-options="pickerWeekStep" >
      </el-date-picker>
      </el-form-item>

       <el-form-item label="游戏平台" prop="gamePlatformId">
        <el-select v-model="formInline.gamePlatformId"   placeholder="请选择"  style="width:200px">
          <el-option
            v-for="item in GAME_PLATFORM_LIST.filter((item)=>{return item.type.includes('taskDelete')})"
            :label="item.title"
            :key="item.value"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
       <el-form-item label="审核状态" prop="checkStatus">
        <el-select v-model="formInline.checkStatus"   placeholder="请选择"  style="width:200px">
          <el-option
            v-for="item in CHECK_STATUS_LIST"
            :label="item.title"
            :key="item.value"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="执行状态" prop="executeStatus">
        <el-select v-model="formInline.executeStatus"   placeholder="请选择"  style="width:200px">
          <el-option
            v-for="item in EXECUTE_STATUS_LIST"
            :label="item.title"
            :key="item.value"
            :value="item.value"
             checked
          ></el-option>
        </el-select>
      </el-form-item>

      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="toSearch">搜索
      </el-button>
      <el-button @click="selfResetForm('ruleForm')">重置</el-button>
    </el-form>
  </div>

</template>
<script>
import { form, grid, pickerOption } from '@/build';
import { GAME_PLATFORM_LIST, CHECK_STATUS_LIST, EXECUTE_STATUS_LIST } from './data';

export default {
  name: 'form-filter',
  mixins: [form, grid, pickerOption],
  data() {
    return {
      GAME_PLATFORM_LIST,
      EXECUTE_STATUS_LIST,
      CHECK_STATUS_LIST,
      formInline: {
        time: [
          moment().format('YYYY-MM-DD 00:00:00'),
          moment().format('YYYY-MM-DD 23:59:59'),
        ],
        checkStatus: undefined,
        executeStatus: undefined,
        gamePlatformId: undefined,

      },
    };
  },
  methods: {
    toSearch() {
      this.$emit('on-filter', this.formInline);
    },
    selfResetForm(formName) {
      this.resetForm(formName);
      this.$emit('on-filter', this.formInline);
    },
  },
  mounted() {
    // window.addEventListener('keyup', (e) => {
    //   const event = e || window.event;
    //   const code = event.keyCode || event.which || event.charCode;
    //   if (code == 13) {
    //     this.toSearch();
    //   }
    // });
  },
};
</script>

<style lang="scss" scoped>
  .with-pre-select {
    .el-input-group__prepend {
      .el-select {
        width: 160px;
      }
    }
  }
/deep/ .data-item .el-select{position: relative; left:5px;}
/deep/ .data-item input.el-input__inner{border-top-right-radius: 0;border-bottom-right-radius: 0;background: #f5f7fa !important;color:#909399;border-right:none;width:130px}
/deep/ .data-item  input.el-input__inner:focus{border-color:#dcdfe6 !important}
/deep/ .data-item div.el-input__inner.el-date-editor{border-top-left-radius: 0 !important;border-bottom-left-radius: 0 !important;}
</style>
